CC=gcc
CFLAGS=-Wall -g
LFLAGS=-L ./include -lpthread

src=$(wildcard *.c)
targets=$(patsubst %.c, %, $(src))
test_targets=$(patsubst %.c,./%, $(src))
grep_self=| grep -v grep

all:$(targets)

$(targets):%:%.c
	$(CC) $< -o $@ $(CFLAGS) $(LFLAGS)

test:
	for x in $(test_targets);\
		do\
			ps -eo pid,ppid,sid,tty,pgrp,comm,cmd | grep --color=auto -H "$$x";\
		done

.PHONY:clean all
clean:
	- rm -rf $(targets) *.o -f